package com.tencent.iov.cowin.befsale.clue.repository.clue.impl;

import com.github.pagehelper.Page;
import com.tencent.iov.cowin.befsale.clue.dao.clue.ClueOrderDao;
import com.tencent.iov.cowin.befsale.clue.domain.clue.po.ClueOrder;
import com.tencent.iov.cowin.befsale.clue.repository.clue.ClueOrderManager;
import com.tencent.iov.cowin.befsale.clue.value.contants.ServiceConstant;
import com.software.boot.dao.annotation.TargetDataSource;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Describe: 线索订单表_Manager实现层
 * @author: whp
 * @created: 2021-12-21 16:16:16
 * @version: 1.0
 */
@Service
public class ClueOrderManagerImpl implements ClueOrderManager {

    @Autowired
    private ClueOrderDao clueOrderDao;

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public ClueOrder getDetailById(Long id) {
        return clueOrderDao.getDetailById(id);
    }

    /**
     * 单条数据插入ClueOrder
     *
     * @param request
     * @return 插入的条数
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insert(ClueOrder request) {
        return clueOrderDao.insert(request);
    }

    /**
     * 批量插入ClueOrder
     *
     * @param requests
     * @return 批量插入的条数
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insertBatch(List<ClueOrder> requests) {
        return clueOrderDao.insertBatch(requests);
    }

    /**
     * 单条ClueOrder更新
     *
     * @param request
     * @return 更新的条数
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int update(ClueOrder request) {
        return clueOrderDao.update(request);
    }

    /**
     * 单条ClueOrder删除
     *
     * @param id
     * @return 删除的条数
     */
    @Override
    public int delete(Integer id) {
        return clueOrderDao.delete(id);
    }

    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public List<ClueOrder> getListByParam(ClueOrder request) {
        return clueOrderDao.getListByParam(request);
    }

    /**
     * 根据条件查询对象page记录
     *
     * @param request
     * @param rowBounds
     * @return 分页对象
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public Page<ClueOrder> getPageByParam(ClueOrder request, RowBounds rowBounds) {
        return clueOrderDao.getPageByParam(request, rowBounds);
    }

    @Override
    public ClueOrder getOneByParam(ClueOrder request) {
        return clueOrderDao.getOneByParam(request);
    }
}
